export function publicTotal(list) {
  const sum = list.reduce((accumulator, currentObject) => {
    return accumulator + (Number(currentObject.unitPrice) + Number(currentObject.salePrice)) * currentObject.commodityNum;
  }, 0);
  return sum;
}
export function publicTotal2(list) {
  const sum = list.reduce((accumulator, currentObject) => {
    return accumulator + Number(currentObject.actualPrice);
  }, 0);
  return sum;
}
// 四舍五入数字
export function roundDecimal(num, decimalPlaces) {
  let factor = Math.pow(10, decimalPlaces);
  let tempNum = num * factor;
  let roundedTempNum = Math.round(tempNum);
  return roundedTempNum / factor;
}

export function mathRound(num) {
  return Math.round(num);
}
